package io.seata.sample;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @author Mr.Lin
 * @version v1.0.0
 * @description
 * @date Created in 2020/4/15/015 16:41
 */
@ControllerAdvice
public class GlobalExceptionHandler {

    /**
     * Exception异常处理
     */
    @ExceptionHandler(value = Exception.class)
    @ResponseBody
    public Object exceptionHandler(HttpServletRequest request, Exception e) {

        String s = "报错啦:" + e.getMessage();
        System.out.println(s);
        return s;
    }
}
